< previous page page_371 next page >

Page 371
If you have multiple public classes defined in a DLL, you can access all of them:
Dim objCEO As New EmployeeDLL.clsExecutive
Dim objDilbert As New EmployeeDLL.clsEngineer
Note that as you write code that uses these external classes, all the same editor features (such as parameter lists) are available in the Visual Basic editing window.
Setting the Instancing Property
In ActiveX DLL and ActiveX EXE projects, the Properties window for a class module has an extra property, the Instancing property, which is not available in a Standard EXE project. This property determines how instances of a class are created; the options vary for different project types. While learning the basics of classes and OOP, you can forget about this property and experiment with a Standard EXE project. However, this property is usually set during the creation of a class, so I mention it here. Table 16.1 describes the settings of the Instancing property.
Table 16.1 Using the Instancing Property
ValueNameComponentsDescription
1PrivateEXE and DLLThe class cannot be accessed from outside the current project.
2PublicNot CreatableEXE and DLLInstances of the class can be created only within the project that defines the class. However, other applications can access instances after they are created.
3SingleUseEXE onlyEach time a new instance of a class is created, a new copy of the EXE containing the class is started.
4GlobalSingleUseEXE onlyLike SingleUse, but it makes the properties and methods appear as global variables and preocedures in the client program.
5MultiUseEXE and DLLOther applications can create any number of instances of the class, and only one copy of the program containing the class is started. ActiveX DLL projects generally use this setting.
6GlobalMultiUseEXE and DLLLike MultiUse, but it makes the properties and methods appear as global variables and procedures in the client program.

Another way to look at the information in the preceding table is to think of EXE files versus DLL files. An ActiveX DLL file is intended to be a shared component, meaning the same

 
< previous page page_371 next page >